<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ng="http://angularjs.org" id="ng-app" ng-app="moil">
<head>
    <%@include file="/WEB-INF/jsp/commons/meta.jsp" %>
    <title>${title}</title>
    <meta charset="utf-8">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <!-- 响应式设计 -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript">
        (function () {
            angular.module("moil", []);
            window.AllDocCtrl = function ($scope, $rootScope) {

            }
        })();
    </script>
</head>
<body ng-controller="AllDocCtrl">
<!-- content -->
<!-- 分页显示演示开始 -->
<div class="u_child_box">
    <div class="u_title_bar">
        <span id="device_info" class="u_title">角色管理</span>
    </div>

    <div class="u_c_header ">
        <div class="u_c_m_h">
            <form id="listForm" class="form-inline" action="${ctx}/security/roles/list" method="get">
                <input type="hidden" name="pageNo" id="pageNo" value="${pageData.pagination.pageNo}"/>
                <input type="hidden" name="fieldName" id="fieldName" value="${pageData.compositor.fieldName}"/>
                <input type="hidden" name="compositorType" id="compositorType"
                       value="${pageData.compositor.compositorType}"/>

                <div class="pull-left">
                    <label>角色名称:</label>
                    <y:search fieldType="S" fieldList="name" matchType="LIKE" className="input-medium search-query"/>
                    <button class="btn u_c_btn" onclick="search()" type="button">
                        <i class="icon-search"></i>
                        搜索
                    </button>
                </div>
                <div class="pull-right">
                    <label></label>
                    <a href="${ctx}/security/roles/new"  class="btn u_c_btn">添加角色</a>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-striped table-bordered table-condensed">
        <thead>
        <tr>
            <th>#</th>
            <th>
                <a href="javascript:sort('name')">角色名称</a>
            </th>
            <th>
                <a href="javascript:sort('type')">类型</a>
            </th>
            <th>
                <a href="javascript:sort('enable')">是否禁用</a>
            </th>
            <th width="36%">
                <a href="javascript:sort('resources')">权限范围</a>
            </th>
            <th>插入时间</th>
            <th>更新时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="entity" items="${pageData.result}" varStatus="index">
            <tr  <c:if test="${!entity.visible}"></c:if>>
                <td>${index.index + 1}</td>
                <td>${entity.name}</td>
                <td>${entity.type}</td>
                <td>${entity.enable?'否':'是'}</td>
                <td>
                    |
                    <c:forEach items="${entity.resources}" var="resources">
                        ${resources.name } |
                    </c:forEach>
                </td>
                <td>${entity.insertTime}</td>
                <td>${entity.lastUpdateTime}</td>
                <td>
                    <a href="${ctx}/security/roles/edit/${entity.id}">修改</a> | <a
                        href="${ctx}/security/roles/delete/${entity.id}" confirm="删除后无法恢复,确定要删除吗?">刪除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <%@ include file="/WEB-INF/jsp/commons/pager.jsp" %>
</div>
</body>
</html>